package com.atgugu.realtime.function;

import com.atgugu.realtime.util.IkUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2022/1/5 10:11
 */
@FunctionHint(output = @DataTypeHint("row<keyword string>"))
public class IkAnalyzer extends TableFunction<Row> {
    public void eval(String kw) {
        // 实现分词
        for (String word : IkUtil.split(kw)) {
            collect(Row.of(word));
            
        }
    }
}
